<template>
  <div class="baseMain">
    <div class="baseHaed">
      <el-button
          v-if="publicForm.isTitle"
          type="primary"
          size="small"
          @click="showSearch=!showSearch"
          class="showSearch"
      >
        <!--          @click="publicForm.showSearch=!publicForm.showSearch"-->
        <span class="opensearchs_more">{{ publicForm.title }}</span>
        <el-icon>
          <ArrowUpBold v-if="showSearch"/>
          <ArrowDownBold v-else/>
        </el-icon>
      </el-button>
      <slot name="formTableBtn"></slot>
    </div>
    <div class="baseform form_label_com" v-show="showSearch">
      <template v-if="formType=='1'">
        <formColumn
            :columnData="publicForm.data"
            :columnModel="formData"
            v-bind="$attrs"
        >
        </formColumn>
      </template>
      <template
          v-else-if="formType=='2'"
          v-for="(item,index) in tableData"
          :key="index">
        <div class="form_label_children_com">
          <formColumn
              :columnData="publicForm.data"
              :columnModel="item"
              v-bind="$attrs"
          >
          </formColumn>
          <slot name="formTableChildren" :index="index"></slot>
        </div>
      </template>
    </div>
  </div>
</template>

<script>
import {getCurrentInstance, reactive, ref} from "vue";
import {uploadFile} from "@/api/rules"
import formColumn from "@/components/common/formColumn";

export default {
  name: "formLabel",
  components: {formColumn},
  props: {
    formType: {
      /**
       * 1 对象，不可以新增删除
       * 1 数组，可以新增删除
       * **/
      type: String,
      default: "1"
    },
    publicForm: {
      type: Object,
      default: () => {
      }
    },
    // formData
    formData: {
      type: Object,
      default: () => {
      }
    },
    tableData: {
      type: Array,
      default: () => []
    }
  },
  setup(props, context) {
    const {proxy} = getCurrentInstance()
    const showSearch = ref(true)
    return {showSearch}
  },
  data() {
    return {}
  },
  created() {
  },
  mounted() {
  },

  methods: {},
  computed: {},
  watch: {},
  beforeDestroy() {
  },
  destroyed() {
  }
}
</script>

<style scoped lang="scss">
.baseMain {
  background: #fff;
  margin: 7px;
  padding: 5px 18px;

  .baseHaed {
    margin-bottom: 10px;
  }

}
</style>